<div xmlns:th="http://www.thymeleaf.org" th:fragment="menu" class="navbar-default left-menu" role="navigation">
    <div class="left-menu-title">
        <span class="fa fa-home"></span>
        工作台
    </div>
    <ul class="nav panel-group" id="menuList">
        <!--<li class="panel" ng-repeat="topMenu in topMenuList | filter : {pid : '0'}" ng-style="{'border-top' : $index == 0 ? 'none' : ''}">
            <a class="pointer" data-target="#collapse{{$index}}" data-toggle="collapse" data-parent="#menuList" ng-click="getIcon($index)">
                {{topMenu.menuName}}
                <span class="fr fa" ng-class="{'fa-chevron-down' : topMenu.menuUrl == parentMenuName, 'fa-chevron-right' : topMenu.menuUrl != parentMenuName}"></span>
            </a>
            <ul id="collapse{{$index}}" class="nav nav-second-level collapse" ng-class="{'in' : topMenu.menuUrl == parentMenuName}">
                <li ng-repeat="secondMenu in secondMenuList | filter : {pid : topMenu.id}" ui-sref-active="active">
                    <a ui-sref="{{secondMenu.menuUrl}}" href="##" ng-click="activeMenu(topMenu.menuUrl, secondMenu.menuUrl)">{{secondMenu.menuName}}</a>
                </li>
            </ul>
        </li>-->
    </ul>

    <script>
        $(function () {
            $.getJSON(s_url + '/menu', function (result) {
                var list = result.data;
                var pMenu = $.grep(list, function (item) {
                    return item.pUid == '0';
                })
                for (var i = 0; i < pMenu.length; i++) {
                    var str = '<li class="panel" style="border-top: ' + (i == 0 ? 'none' : '') + '">' +
                        '<a class="pointer" data-target="#collapse' + i + '" data-toggle="collapse" data-parent="#menuList">' + pMenu[i].displayName +
                        '   <span class="fr fa" class="fa-chevron-down"></span>' +
                        '</a>' +
                        '<ul id="collapse' + i + '" class="nav nav-second-level collapse">';
                    // 输出子菜单
                    var cMenu = $.grep(list, function (item) {
                        return item.pUid == pMenu[i].uid;
                    })
                    for (var j = 0; j < cMenu.length; j++) {
                        str += '<li><a href="###">' + cMenu[j].displayName + '</a></li>';
                    }
                    str += '</ul></li>';
                    $("#menuList").append(str);
                }
            })
        })
    </script>
</div>